<template>
    <div class="breadcrumb_container">
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/home' }"><span @click="resetpath">首页</span></el-breadcrumb-item>
            <el-breadcrumb-item v-if="this.$store.state.headerTitle !='' ">
                {{this.$store.state.headerTitle}}
            </el-breadcrumb-item>
            <el-breadcrumb-item
                v-if="this.$store.state.headerChildTitle !=''"
                :to=" this.$route.path == '/goods/add' || this.$route.path == '/goods/edit' ? { path: '/goods' } : '' "
            >
                {{this.$store.state.headerChildTitle}}
            </el-breadcrumb-item>
            <el-breadcrumb-item v-if=" this.$route.path == '/goods/add' ">
                添加商品
            </el-breadcrumb-item>
            <el-breadcrumb-item v-else-if=" this.$route.path == '/goods/edit' ">
                修改商品
            </el-breadcrumb-item>
        </el-breadcrumb>
    </div>
</template>

<script>
export default({
    name:'homebreadcrumb',
    methods: {
        resetpath(){
            this.$store.commit('resetInfo',false);
        }
    }
})
</script>

<style lang="less">
    .breadcrumb_container{
        background-color: #3a2c3b;
        text-align: left;
        padding: 5px 10px;
        .el-breadcrumb{
            font-size: 15px;
            line-height:20px;
            .el-breadcrumb__inner, .el-breadcrumb__inner:hover, .is-link{
                color: #fff;
            }
            .is-link:hover{
                color: #1495e7;
            }
        }
    }
</style>